package com.fdd.op.sdk.autoconfigure;

import com.fdd.op.sdk.constants.Constants;
import com.fdd.op.sdk.internal.util.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * sdk配置实体类
 */
@ConfigurationProperties(prefix = "fdd.sdk")
public class SdkProperties {

    private String serverUrl;

    private String appid;

    private String appkey;

    private Integer connectTimeout;

    private Integer readTimeout;

    private String authType;

    public String getServerUrl() {
        return serverUrl;
    }

    public void setServerUrl(String serverUrl) {
        this.serverUrl = serverUrl;
    }

    public String getAppid() {
        return appid;
    }

    public void setAppid(String appid) {
        this.appid = appid;
    }

    public String getAppkey() {
        return appkey;
    }

    public void setAppkey(String appkey) {
        this.appkey = appkey;
    }

    public Integer getConnectTimeout() {
        return connectTimeout;
    }

    public void setConnectTimeout(Integer connectTimeout) {
        this.connectTimeout = connectTimeout;
    }

    public Integer getReadTimeout() {
        return readTimeout;
    }

    public void setReadTimeout(Integer readTimeout) {
        this.readTimeout = readTimeout;
    }

    public String getAuthType() {
        if(StringUtils.isBlank(authType)){
            return Constants.AUTH_OAUTH;
        }
        return authType;
    }

    public void setAuthType(String authType) {
        this.authType = authType;
    }
}
